//
//  PackageCollectSectionFooter.m
//  BaseProject
//
//  Created by 王洋 on 2020/7/28.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "PackageCollectSectionFooter.h"

@implementation PackageCollectSectionFooter

+ (CGFloat)calculateHeightWithModel:(CommonCollectModel *)model {
    
    CGFloat height = 80;
    
    if (model.seller.consultingStar.length > 0) {
        height = height + 40;
    }
    
    if (model.seller.arrivalGift.length > 0) {
        height = height + 40;
    }
    
    return height;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        [self.imBtn pp_clipCorners:UIRectCornerAllCorners radius:self.imBtn.frame.size.height/2];

        [self.btn1 pp_clipCorners:UIRectCornerAllCorners radius:self.btn1.frame.size.height/2 border:1 color:UIColorHex(0xff4242)];
        
        [self.btn2 pp_clipCorners:UIRectCornerAllCorners radius:self.btn1.frame.size.height/2 border:1 color:UIColorHex(0xff4242)];

    });
    
}

- (void)fillFootWithModel:(CommonCollectModel *)model {
    
    if (model.seller.consultingStar.length > 0) {
        self.imGiftLab.text = model.seller.consultingStar;
        self.zixunHeight.constant = 40;
    } else {
        self.zixunHeight.constant = CGFLOAT_MIN;
    }
    
    if (model.seller.arrivalGift.length > 0) {
        self.arriveGiftLab.text = model.seller.arrivalGift;
        self.daodianHeight.constant = 40;
    } else {
        self.daodianHeight.constant = CGFLOAT_MIN;
    }
}


- (IBAction)imAction:(id)sender {
    
    if (self.PackageCollectSectionFooterBlock) {
        self.PackageCollectSectionFooterBlock();
    }
}


@end
